package mycompany.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Volodymyr Lavrynovych <volodya.lavrynovych@gmail.com>
 */
@Controller
public class HelloController {

    @RequestMapping("/hello")
    public ModelAndView hello() {
        return new ModelAndView("hello");
    }
    
    @RequestMapping("/im")
    public ModelAndView im() {
        return new ModelAndView("im");
    }
    
    @RequestMapping("/open/{type}/{chatId}")
    public ModelAndView chatOpener(@PathVariable(value = "type") String type, @PathVariable(value = "chatId") String chatId) {
        ModelAndView model = new ModelAndView("chats/opener");
        model.addObject("chatId", chatId);
        model.addObject("type", type);
        return model;
    }
    
}
